﻿<storeControls:StoreApplicationPage 
    x:Class="Store.WP7.Views.ProductDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:storeControls="clr-namespace:Store.WP7.Controls;assembly=Store.WP7.Controls"
    xmlns:behaviors="clr-namespace:Store.WP7.Framework.Interactions;assembly=Store.WP7.Framework"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=ProductDetailsViewModel}">

    <i:Interaction.Behaviors>
        <behaviors:SystrayBehavior SystrayOpacity="0.5"
                                   IsBusy="{Binding IsBusy}"
                                   BusyMessage="{Binding BusyMessage}" />
    </i:Interaction.Behaviors>

    <Grid x:Name="LayoutRoot"
          Background="Transparent">

        <Image Stretch="None"
               Source="/Assets/Images/PageBackground.png"
               VerticalAlignment="Top" />

        <controls:Pivot Margin="0,100,0,0">
            <controls:PivotItem Header="fiche produit" Margin="12,12,12,0">

                <Grid x:Name="ContentPanel"
                      Margin="12,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock Style="{StaticResource PhoneTextTitle2Style}"
                               TextWrapping="Wrap"
                               Text="{Binding ProductViewModel.Title}"
                               FontSize="34"
                               Foreground="{StaticResource AccentBrushDark}"
                               Margin="0,0,0,24"
                               x:Name="ProductTitle">
                        <i:Interaction.Behaviors>
                            <behaviors:ContinuumDetailBehavior />
                        </i:Interaction.Behaviors>
                    </TextBlock>

                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                        	<ColumnDefinition Width="*" />
                        	<ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                            
                        <Grid VerticalAlignment="Center"
                                HorizontalAlignment="Left"
                                Width="173"
                                Height="173">
                            <Rectangle Fill="Orange"
                                        Margin="0,0,10,10" />
                            <Rectangle Fill="#FFFFCC00"
                                        Margin="8,10,-8,-10" />
                            <Image Source="{Binding ProductViewModel.PictureUrl}"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Margin="20,20,0,0" />
                        </Grid>

                        <Grid Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            
                            <TextBlock Style="{StaticResource PhoneTextTitle2Style}"
                                        FontFamily="Segoe WP Black"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Top"
                                        Text="{Binding ProductViewModel.Price}"
                                        Foreground="{StaticResource ForegroundBrush}" />

                            <Button Grid.Row="1"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Bottom"
                                    Style="{StaticResource ButtonStyle}"
                                    Background="{StaticResource AccentBrushDark}">
                              <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                  <ec:CallMethodAction MethodName="AddToBasket" TargetObject="{Binding Mode=OneWay}" />
                                </i:EventTrigger>
                              </i:Interaction.Triggers>
                                <TextBlock Text="AJOUTER AU PANIER"
                                           TextAlignment="Center"
                                           TextWrapping="Wrap" />
                            </Button>

                        </Grid>

                    </Grid>

                </Grid>
            </controls:PivotItem>
            
            <controls:PivotItem Header="détails" Margin="12,12,12,0">

                <Border Background="{StaticResource ItemBackgroundBrush}"
                        VerticalAlignment="Top"
                        Margin="12">
                    <ScrollViewer Margin="12">
                        <TextBlock Style="{StaticResource PhoneTextTitle3Style}"
                                   TextWrapping="Wrap"
                                   Text="{Binding ProductViewModel.Description}"
                                   Foreground="{StaticResource ForegroundBrush}"
                                   Margin="0" />
                    </ScrollViewer>
                </Border>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
 
    <storeControls:StoreApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/icons/appbar.caddie.rest.png"
                                            Text="mon panier"
                                            Click="BasketAppBarIconButton_Click"/>
        </shell:ApplicationBar>
    </storeControls:StoreApplicationPage.ApplicationBar>

</storeControls:StoreApplicationPage>
